﻿<?xml version="1.0" encoding="utf-8" ?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
           targetNamespace="http://novakov.miecio.net/schemas/server-dashboard/config"
           xmlns:tns="http://novakov.miecio.net/schemas/server-dashboard/config">    
  
  <xs:simpleType name="diskLetter">
    <xs:restriction base="xs:string">
      <xs:length value="1" />
      <xs:pattern value="[a-zA-Z]" />
    </xs:restriction>
  </xs:simpleType>

  <xs:complexType name="diskInfo" mixed="true">
    <xs:attribute name="letter"
                  type="tns:diskLetter" />
    <xs:attribute name="warn"
                  type="xs:int" />
    <xs:attribute name="fail"
                  type="xs:int" />
  </xs:complexType>

  <xs:complexType name="services">
    <xs:choice minOccurs="0"
               maxOccurs="unbounded">
      <xs:element name="service"
                  type="xs:string" />
    </xs:choice>
  </xs:complexType>

  <xs:complexType name="eventLogs">
    <xs:choice minOccurs="0" maxOccurs="unbounded">
      <xs:element name="eventlog" type="xs:string" />
    </xs:choice>
    <xs:attribute name="showOnDashboard" type="xs:boolean" />
  </xs:complexType>

  <xs:complexType name="disks">
    <xs:choice minOccurs="0"
               maxOccurs="unbounded">
      <xs:element name="disk"
                  type="tns:diskInfo" />
    </xs:choice>
  </xs:complexType>

  <xs:simpleType name="processMonitoringType">
    <xs:restriction base="xs:string">
      <xs:enumeration value="Run" />
      <xs:enumeration value="NotRun" />
      <xs:enumeration value="MinMemory" />
      <xs:enumeration value="MaxMemory" />
    </xs:restriction>
  </xs:simpleType>

  <xs:complexType name="process">
    <xs:attribute name="name"
                  type="xs:string" />
    <xs:attribute name="type"
                  type="tns:processMonitoringType" />
    <xs:attribute name="memory"
                  type="xs:int" />
  </xs:complexType>

  <xs:complexType name="processes">
    <xs:choice minOccurs="0"
               maxOccurs="unbounded">
      <xs:element name="process"
                  type="tns:process" />
    </xs:choice>
  </xs:complexType>
  
  <xs:complexType name="dashboard">
    <xs:all>
      <xs:element name="services"
                  type="tns:services" />
      <xs:element name="eventlogs"
                  type="tns:eventLogs" />
      <xs:element name="disks"
                  type="tns:disks" />
      <xs:element name="processes"
                  type="tns:processes" />
    </xs:all>
  </xs:complexType>

  <xs:element name="dashboard"
              type="tns:dashboard" />
</xs:schema>
